Conditions | 1 |
Paths | 1 |
Total Lines | 68 |
Code Lines | 50 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | import Vue from 'vue' |
||
17 | export function createRouter(base, i18n) { |
||
18 | return new Router({ |
||
19 | mode: 'history', |
||
20 | base: base, |
||
21 | linkActiveClass: 'open active', |
||
22 | scrollBehavior: () => ({ y: 0 }), |
||
23 | routes: [ |
||
24 | { |
||
25 | path: '/campaign/', |
||
26 | name: 'campaign', |
||
27 | component: Full, |
||
28 | meta: { |
||
29 | label: i18n.t('labels.admin.title') |
||
30 | }, |
||
31 | children: [ |
||
32 | { |
||
33 | path: ':id', |
||
34 | name: 'id', |
||
35 | component: MainWindow, |
||
36 | meta: { |
||
37 | label: i18n.t('labels.admin.campaigns.title') |
||
38 | } |
||
39 | }, |
||
40 | { |
||
41 | path: ':id/donate', |
||
42 | name: 'donate', |
||
43 | component: DonateWindow, |
||
44 | meta: { |
||
45 | label: i18n.t('labels.admin.campaigns.title') |
||
46 | } |
||
47 | }, |
||
48 | { |
||
49 | path: ':id/donate/status', |
||
50 | name: 'donateStatus', |
||
51 | component: StatusWindow, |
||
52 | meta: { |
||
53 | label: i18n.t('labels.admin.campaigns.title') |
||
54 | } |
||
55 | }, |
||
56 | { |
||
57 | path: ':id/recurrent', |
||
58 | name: 'recurrent', |
||
59 | component: RecurrentWindow, |
||
60 | meta: { |
||
61 | label: i18n.t('labels.admin.campaigns.title') |
||
62 | } |
||
63 | }, |
||
64 | { |
||
65 | path: ':id/recurrent/donate', |
||
66 | name: 'recurrentDonate', |
||
67 | component: RecurrentDonateWindow, |
||
68 | meta: { |
||
69 | label: i18n.t('labels.admin.campaigns.title') |
||
70 | } |
||
71 | }, |
||
72 | { |
||
73 | path: ':id/recurrent/status', |
||
74 | name: 'recurrentStatus', |
||
75 | component: StatusWindow, |
||
76 | meta: { |
||
77 | label: i18n.t('labels.admin.campaigns.title') |
||
78 | } |
||
79 | } |
||
80 | ] |
||
81 | } |
||
82 | ] |
||
83 | }) |
||
84 | } |
||
85 |